﻿from django.contrib import admin
from django.contrib.auth.models import User, Group
from yazasport.staticpages.models import StaticPage
from yazasport.staticpages.forms import StaticpageForm

def make_visible(modeladmin, request, queryset):
    queryset.update(visible='True')
make_visible.short_description = u"Сделать публичными выбранные вопросы"

class StaticPageAdmin(admin.ModelAdmin):
    
    
    form = StaticpageForm
    fieldsets = (
        (None, {'fields': ('url', 'title', 'header', 'weight', 'content', 'parent')}),
        (u'Дополнительные настройки', {'fields': ('is_public', 'is_in_menu', 'template_name')}),
    )
    list_display = ('title', 'weight', 'url', 'is_public', 'is_in_menu', 'template_name')
    list_display_links = ('url', 'title', 'template_name')
    list_filter = ('is_public', 'is_in_menu')
    list_editable = ('weight', 'is_public', 'is_in_menu')
    search_fields = ('url', 'title')

admin.site.register(StaticPage, StaticPageAdmin)
admin.site.unregister(User)
admin.site.unregister(Group)
